<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
        *{
            margin: 0px;
            padding: 0px;
            list-style: none;
        }
        ul{
            overflow: hidden;
        }
        ul li{
            float: left;
            width: 100px;
            height: 30px;
            margin-right: 10px;

        }
        section>div{
            width: 500px;
            height: 200px;
            text-align: center;
            line-height: 200px;
        }
        </style>
    </head>
    <body>
        <ul>
            <li>我的 </li>
            <li>热门 </li>
            <li>娱乐 </li>
            <li>购物 </li>
            <li>游戏 </li>
        </ul>
        <section>
            <div>我的内容 <img src="images/01.jpeg" alt=""></div>
            <div>热门内容 <img src="images/02.jpg" alt=""></div>
            <div>娱乐内容 <img src="images/03.jpeg" alt=""></div>
            <div>购物内容 <img src="images/04.jpeg" alt=""></div>
            <div>游戏内容 <img src="images/05.jpeg" alt=""></div>
        </section>

        <script>
        var tags=document.getElementsByTagName('li');
        var boxs=document.getElementsByTagName('div');
        for (var i=0;i<tags.length;i++){
            tags[i].index=i;
            tags[i].onclick=function(){
                for (var j=0;j<tags.length;j++){
                    tags[j].style.background='none';
                    boxs[j].style.display='none'
                }
                this.style.background='red' ;
                var n=this.index;
                boxs[n].style.display='block'
             }
        }
        </script>
    </body>
</html>